<?php
class SearchAction extends Action {
	public function queryProj() {	
		if (session ( 'uid' )) {
		import ( "@.ORG.Page" );
		$Pname = $_GET ["pname"];
		$Managername = $_GET ["managername"];
		$Fund = $_GET ["fund"];
		
		$Dao = D ( "ProjectView" );
			
		$condition ['pname'] = array ('like', '%' . $Pname . '%' );
		$condition ['managername'] = array ('like', '%' . $Managername . '%' );
		$condition ['fund'] = array ('like', '%' . $Fund . '%' );
		
		$count = $Dao->where ( $condition )->count ();
		
		$p = new Page ( $count, 10 );
		foreach ( $condition as $key => $val ) {
			$p->parameter .= "$key=" . urlencode ( $val ) . "&";
		}
		// 分页显示输出
		$page = $p->show ();
		
		$list = $Dao->where ( $condition )->order ( 'pname ASC' )->limit ( $p->firstRow . ',' . $p->listRows )->select ();
		
		$this->assign ( 'page', $page );
		$this->assign ( 'list', $list );
		$this->display ();
		
		} else
			$this->error ( "尚未登录" );
	
	}
	public function queryLog(){
		if (session ( 'uid' )) {
		import ( "@.ORG.Page" );
		$Pname = $_GET ["pname"];
		$Content = $_GET ["content"];
		
		$Dao = D ( "MeetingView" );
			
		$condition ['pname'] = array ('like', '%' . $Pname . '%' );
		$condition ['content'] = array ('like', '%' . $Content . '%' );
		
		$count = $Dao->where ( $condition )->count ();
		
		$p = new Page ( $count, 10 );
		foreach ( $condition as $key => $val ) {
			$p->parameter .= "$key=" . urlencode ( $val ) . "&";
		}
		// 分页显示输出
		$page = $p->show ();
		
		$list = $Dao->where ( $condition )->order ( 'date ASC' )->limit ( $p->firstRow . ',' . $p->listRows )->select ();
	
		$this->assign ( 'page', $page );
		$this->assign ( 'list', $list );
		$this->display ();
		
		} else
			$this->error ( "尚未登录" );
		
	}
	public function test(){
	
	$Dao = D ( "MeetingView" );
	$list = $Dao->where ( $condition )->select ();
	dump($list);
	}
}